package sy.service.impl;

import java.io.Serializable;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.apache.log4j.Logger;

import sy.dao.SysBuildingDaoI;
import sy.model.SysBuilding;
import sy.model.SysProject;
import sy.service.SysBuildingServiceI;

@Service("sysBuildingService")
public class SysBuildingServiceImpl implements SysBuildingServiceI {
	
	private static final Logger logger = Logger.getLogger(SysBuilding.class);
	private SysBuildingDaoI sysBuildingDao;


	public SysBuildingDaoI getSysBuildingDao() {
		return sysBuildingDao;
	}

	@Autowired
	public void setSysBuildingDao(SysBuildingDaoI sysBuildingDao) {
		this.sysBuildingDao = sysBuildingDao;
	}

	@Override
	public Serializable save(SysBuilding sysBuilding) {
		
		return sysBuildingDao.save(sysBuilding);
	}

	@Override
	public void remove(String[] ids) {
		// TODO Auto-generated method stub
		for (int i = 0; i < ids.length; i++) {
			SysBuilding sysBuilding =	sysBuildingDao.getSysBuildingById(ids[i]);
			sysBuildingDao.remove(sysBuilding);
		}

	}

	/* (non-Javadoc)
	 * @see sy.service.SysBuildingServiceI#update(sy.model.SysBuilding)
	 */
	@Override
	public void update(SysBuilding sysBuilding) {
		// TODO Auto-generated method stub
		sysBuildingDao.update(sysBuilding);
	}

	/* (non-Javadoc)
	 * @see sy.service.SysBuildingServiceI#list()
	 */
	@Override
	public List<SysBuilding> list() {
		// TODO Auto-generated method stub
		return sysBuildingDao.list();
	}

	/* (non-Javadoc)
	 * @see sy.service.SysBuildingServiceI#getSysBuildingById(java.lang.String)
	 */
	@Override
	public SysBuilding getSysBuildingById(String id) {
		// TODO Auto-generated method stub
		return sysBuildingDao.getSysBuildingById(id);
	}

	/* (non-Javadoc)
	 * @see sy.service.SysBuildingServiceI#listSysBuildingByKey(java.lang.String)
	 */
	@Override
	public List<SysBuilding> listSysBuildingByKey(String key) {
		// TODO Auto-generated method stub
		return sysBuildingDao.listSysBuildingByKey(key);
	}
	
	@Override
	public List<SysBuilding> getBuildingByProject(String projectId) {
		return sysBuildingDao.getBuildingByProject(projectId);
	}


}
